package com.qf.entity.base;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Description:
 * @Author: xbb
 * @Date:2020/4/14
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultEntity<T> {

    private String code;

    private String msg;

    private T data;

    private static final String SUCCESS="ok";
    private static final String ERROR="error";
    private static final String NO_MSG=null;

    public static ResultEntity successs(){
        return new ResultEntity(SUCCESS,NO_MSG,null);
    }

    public static <T>ResultEntity successs(T data){
        return new ResultEntity(SUCCESS,NO_MSG,data);
    }

    public static <T>ResultEntity error(String msg){
        return new ResultEntity(ERROR,msg,null);
    }
}
